<?php
namespace app\admin\validate;
use think\Validate;

class Category extends Validate{
	/**
	*路由规则
	**/
    protected $rule = [
        ['name','require|max:10','分类名称不能为空|分类名称不能超过10个字符'],
        ['parent_id','number','上级分类ID必须是数字'],
        ['id','number','ID必须是数字'],
        ['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
        ['listorder','number'],
    ];

    /**
    *验证场景
    **/
    protected $scene = [
    	'add' => ['id','name','parent_id'], //添加
    	'listorder' => ['id','listorder'],//排序
        'status' => ['id','status'],//修改状态、删除
    ];
}
